//
//  HMSetAndHelpCell.m
//  仿真开发
//
//  Created by LZH on 2017/3/23.
//  Copyright © 2017年 B.HOPE. All rights reserved.
//

#import "HMSetAndHelpCell.h"
#import <Masonry.h>

@interface HMSetAndHelpCell ()

//图标
@property(nonatomic,weak)UIImageView  *iconView;
//图标名
@property(nonatomic,weak)UILabel  *nameLabel;

@end


@implementation HMSetAndHelpCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupUI];
    }
    
    return self ;
}


-(void)setupUI{
    
    //UIimageView
    UIImageView *imageView = [[UIImageView alloc]init];

    UIImage *image = [UIImage imageNamed:@"说明"];
    
    imageView.image = image;
    
    //记录
    self.iconView = imageView;
    //.添加contentView
    [self.contentView addSubview:imageView];
    
    
    
    //宽度
    CGFloat width = 24;
    CGFloat margin = 10;
    
  
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.contentView).offset(margin);
        make.size.mas_equalTo(CGSizeMake(width, 24));
        make.centerY.mas_equalTo(self.contentView);
        
    }];
    
    
    
    
    //UIlabel
    UILabel *nameLabel = [[UILabel alloc]init];

    nameLabel.font = [UIFont systemFontOfSize:15.0];
    nameLabel.text = @"医生";
    
    
    //记录
    self.nameLabel = nameLabel;

    [self.contentView addSubview:nameLabel];

    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(imageView.mas_right).offset(margin);
        make.centerY.mas_equalTo(self.contentView);
        
    }];
    
    
    
    
    
    //右边尖括号
    UIImageView *rightImage = [[UIImageView alloc]init];
    
    UIImage *img = [UIImage imageNamed:@"position-right"];
    
    rightImage.image = img;
    
    [self.contentView addSubview:rightImage];
    
    [rightImage sizeToFit];
   
    [rightImage mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.right.mas_equalTo(self.contentView).offset(-width+10);
        make.centerY.mas_equalTo(self.contentView);
        
    }];
    
    
}




-(void)setArrList:(HMSetAndHelpModel *)arrList
{
    _arrList = arrList;
    
    self.iconView.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",arrList.icon]];
    
    self.nameLabel.text = arrList.name;
    
}

@end


